package com.luo.aware;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;

/**
 * 测试spring内置的多个Aware接口
 */
@Component
public class DemoAware implements BeanNameAware, ApplicationContextAware, ResourceLoaderAware {

	public String myself="DemoAware";
	public DemoAware() {
		System.out.println("DemoAware constructor");
	}

	public DemoAware(String myself) {
		this.myself = myself;
		System.out.println("DemoAware constructor/myself");
	}

	@Override
	public void setBeanName(String name) {
		System.out.println("invoke DemoAware#setBeanName");
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		System.out.println("invoke DemoAware#setApplicationContext");
	}

	@Override
	public void setResourceLoader(ResourceLoader resourceLoader) {

	}
}
